package cn.it.hbbt.controller;

import cn.it.hbbt.entity.Student;
import cn.it.hbbt.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Date;


@Controller
public class getPOJO {
   @RequestMapping("/getAddJSP")//获取提交表单的页面
    public String get(){
        return "add";
    }
    @RequestMapping("/addUser")//处理页面表单提交的请求
    public String add(User user){
        System.out.println(user);
        return "add";
    }
    @RequestMapping(value="/baseType")
    @ResponseBody
    public String baseType(int id){
        return "id:"+id;
    }



    @RequestMapping("addDate")
    public String getJsp(){
       return "addDate";
    }
    @RequestMapping("dateConverterTest")
    @ResponseBody
    public String dateConverterTest(Date date){
       return date.toString();
    }


    @RequestMapping("addStudent")
    public String getJSP(){
        return "addStudent";
    }
    @RequestMapping("studentConverterTest")
    @ResponseBody
    public String studentConverterTest(Student student){
       return student.toString();
    }

}
